<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>添加商品分类页面</title>
<link rel="stylesheet" href="layui/css/layui.css" />
</head>
<body>
	<form class="layui-form" style="margin-top: 20px;">
		<div class="layui-form-item">
			<label class="layui-form-label"><span style="color: red;">* </span>商品名称：</label>
			<div class="layui-input-inline">
				<input type="text" name="p_name" id="p_name" required
					lay-verify="required" class="layui-input">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">品牌：</label>
			<div class="layui-input-inline">
				<input type="text" name="p_brand" id="p_brand" required
					lay-verify="required" class="layui-input">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label"><span style="color: red;">* </span>所属分类：</label>
			<div class="layui-input-inline">
				<!-- <input type="text" name="p_type" id="p_type" required
					lay-verify="required" class="layui-input"> -->
				<select name="pcat_id" id="pcat_id" lay-verify="" lay-search>
					<option value="">请输入分类</option>
					<option value="5">华为</option>
					<option value="6">荣耀</option>
					<option value="7">荣耀时尚本系列</option>
					<option value="8">华为matebook系列</option>
					<option value="9">荣耀系列</option>
					<option value="10">华为系列</option>
					<option value="11">蓝牙耳机</option>
					<option value="12">智能音箱</option>
				</select>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">型号：</label>
			<div class="layui-input-inline">
				<input type="text" name="p_type" id="p_type" required
					lay-verify="required" class="layui-input">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label"><span style="color: red;">* </span>上下架：</label>
			<div class="layui-input-block">
				<input type="radio" name="p_state" value="1" title="上架" checked>
				<input type="radio" name="p_state" value="2" title="下架">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">内存容量：</label>
			<div class="layui-input-inline">
				<input type="text" name="p_memcapa" id="p_memcapa" required
					lay-verify="required" class="layui-input">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">储存容量：</label>
			<div class="layui-input-inline">
				<input type="text" name="p_stocapa" id="p_stocapa" required
					lay-verify="required" class="layui-input">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">屏幕尺寸：</label>
			<div class="layui-input-inline">
				<input type="text" name="p_size" id="p_size" required
					lay-verify="required" class="layui-input">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">像素：</label>
			<div class="layui-input-inline">
				<input type="text" name="p_pixel" id="p_pixel" required
					lay-verify="required" class="layui-input">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">分辨率：</label>
			<div class="layui-input-inline">
				<input type="text" name="p_resolution " id="p_resolution " required
					lay-verify="required" class="layui-input">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">核心数：</label>
			<div class="layui-input-inline">
				<input type="text" name="p_corenum" id="p_corenum" required
					lay-verify="required" class="layui-input">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">网络类型：</label>
			<div class="layui-input-inline">
				<input type="text" name="p_networktype" id="p_networktype" required
					lay-verify="required" class="layui-input">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">网络模式：</label>
			<div class="layui-input-inline">
				<input type="text" name="p_networkmodel" id="p_networkmodel" required
					lay-verify="required" class="layui-input">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">CPU型号：</label>
			<div class="layui-input-inline">
				<input type="text" name="p_cpumodel" id="p_cpumodel" required
					lay-verify="required" class="layui-input">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">CPU品牌：</label>
			<div class="layui-input-inline">
				<input type="text" name="p_cpubrand" id="p_cpubrand" required
					lay-verify="required" class="layui-input">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">厂商：</label>
			<div class="layui-input-inline">
				<input type="text" name="p_manufacturer" id="p_manufacturer" required
					lay-verify="required" class="layui-input">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">操作系统：</label>
			<div class="layui-input-inline">
				<input type="text" name="p_os" id="p_os" required
					lay-verify="required" class="layui-input">
			</div>
		</div>
		
		<div class="layui-form-item">
			<label class="layui-form-label">商品规格：</label>
			<div class="layui-input-inline">
				<input type="text" name="ps_id" id="ps_id" required
					lay-verify="required" class="layui-input">
			</div>
		</div>
		<!-- <div class="layui-form-item">
			<label class="layui-form-label">预留一：</label>
			<div class="layui-input-inline">
				<input type="text" name="ext1" id="ext1" required
					lay-verify="required" class="layui-input">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">预留二：</label>
			<div class="layui-input-inline">
				<input type="text" name="ext2" id="ext2" required
					lay-verify="required" class="layui-input">
			</div>
		</div> -->
		<div class="layui-form-item">
			<div class="layui-input-block">
				<button class="layui-btn" lay-submit lay-filter="forDemo">提交</button>
				<button type="reset" class="layui-btn layui-btn-primary">重置</button>
			</div>
		</div>
	</form>
	<script type="text/javascript" src="layui/layui.js"></script>
	<script>
		layui.use([ 'form', 'upload' ], function() {
			var form = layui.form;
			var $ = layui.jquery;
			var upload = layui.upload;

			//监听提交
			form.on('submit(forDemo)', function(data) {
				var d = data.field;
				d.method = "addProduct";
				console.log(d);
				var url = '/wk1un2_electricity_digital/Backstage/addProduct';
				$.post(url, d, function(data) {
					if (data.count > 0) {
						console.log('添加成功');
						var index = parent.layer.getFrameIndex(window.name);
						parent.layer.close(index);
					}
				}, "json");
				return false;
			});
		});
	</script>
</body>
</html>